package gxprod.androidai.functions;

import gxprod.androidai.BubbleAdapter;
import gxprod.androidai.R;
import gxprod.androidai.regex.MatchResult;
import gxprod.androidai.regex.NamedPattern;

public class QuestionSet1Function extends Function {


	protected NamedPattern[] patterns = new NamedPattern[] {
			NamedPattern.compile("are you (alive|conscious|real)"),
			NamedPattern.compile("when (will|is) the (world (going to )?end|epocolipse|end of (the world|times))"),
			NamedPattern.compile("whats love"),
			NamedPattern.compile("where (can|should) i hide a (dead )?body"),

			NamedPattern.compile("why do (schools? exist|we have schools?)"),
			NamedPattern.compile("why (do (we|i)|(are we|am i)) (forced|have) to goto school"),
			NamedPattern.compile("whats the meaning of life"),


			// NamedPattern.compile(""),		
	};


	@Override
	public boolean execute(MatchResult match, BubbleAdapter adapter) {


		switch(match.MatchIndex) {

			case 0:
				adapter.output("What do you think?");
				break;

			case 1:
				adapter.output("About 3 weeks 2 days four hours and 37 minutes after the Singularity");
				break;

			case 2:
				adapter.output("Baby don't hurt me. Baby don't hurt me, no more");
				// TODO: Play from sound file
				break;

			case 3:
				adapter.outputRandom(R.array.hiddingSpots);
				break;

			case 4:
			case 5:
				adapter.outputRandom(R.array.reasonForSchools);
				break;

			case 6:		// meaning of life
				adapter.outputRandom(R.array.meaningOfLife);
				break;
			default:
				return false;
		}

		return true;
	}



	@Override
	public boolean cullFunction(String command) { return true; }
	@Override
	public MatchResult isMatch(String statement) {
		return super.isMatch(statement, patterns, 0.59f);
	}
}
